package com.elink.enginerring.news.service;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.elink.enginerring.common.BaseCo;
import com.elink.enginerring.common.ErrorType;
import com.elink.enginerring.common.Pagination;
import com.elink.enginerring.news.dao.NewsCommentMapper;
import com.elink.enginerring.util.JSONUtil;

@Service
public class NewsCommentService implements INewsCommentService {
	@Autowired
	private NewsCommentMapper newsCommentMapper;

	@Override
	public Map<String, Object> getListOfPage(BaseCo bc, String type) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("list", newsCommentMapper.selectList(bc, type));
		map.put("pagination",new Pagination(bc, newsCommentMapper.selectCount(bc, type)));
		return JSONUtil.getJSON(ErrorType.SUCCESS, map);
	}

	@Override
	public Map<String, Object> addAuth(String ids) {
		newsCommentMapper.addAuth(ids);
		return JSONUtil.getJSON(ErrorType.SUCCESS);
	}
}
